package com.ruoyi.busi.guide.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.busi.guide.domain.Experience;
import com.ruoyi.busi.guide.service.IExperienceService;

/**
 * 工作经历Controller
 */
@RestController
@RequestMapping("/busi/guide/experience")
public class ExperienceController extends BaseController {
    @Autowired
    private IExperienceService experienceService;

    /**
     * 根据导师ID获取工作经历列表
     */
    @GetMapping("/mentor/{mentorId}")
    public R listByMentorId(@PathVariable Long mentorId) {
        return R.ok(experienceService.selectByMentorId(mentorId));
    }

    /**
     * 根据公司名称查询工作经历
     */
    @GetMapping("/company")
    public R listByCompany(@RequestParam String company) {
        return R.ok(experienceService.selectByCompany(company));
    }

    /**
     * 新增工作经历
     */
    @PostMapping
    public R add(@RequestBody Experience experience) {
        return R.ok(experienceService.save(experience));
    }

    /**
     * 修改工作经历
     */
    @PutMapping
    public R edit(@RequestBody Experience experience) {
        return R.ok(experienceService.updateById(experience));
    }

    /**
     * 删除工作经历
     */
    @DeleteMapping("/{experienceIds}")
    public R remove(@PathVariable List<Long> experienceIds) {
        return R.ok(experienceService.deleteExperienceByIds(experienceIds));
    }
}
